home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-15 | 2.6 KB | 96 lines | [TEXT/ALFA] |
- # FILE: listFuncs.tcl
- #
- # LAST UPDATE: 01/07/93 7:11:44 AM
- #
- # This file contains the following TCL procedure(s):
- #
- # listFuncs -- returns a list of functions in the current window
- #
- # Place cursor near the front of a language file (TCL or C) and
- # execute it.
-
- # To use, simply source this file place it in the a folder with the
- # name $HOME:Tcl:Usercode: and invoke it implicitly via the "unknown proc".
- #
- # SEE ALSO unknown.tcl
-
- # COPYRIGHT:
- #
- # Copyright ゥ 1992,1993 by David C. Black
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms are permitted
- # provided that the above copyright notice and this paragraph are
- # duplicated in all such forms and that any documentation,
- # advertising materials, and other materials related to such
- # distribution and use acknowledge that the software was developed
- # by David C. Black.
- #
- # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
- # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- #
- ################################################################################
-
- # AUTHOR
- #
- # David C. Black
- # Internet: black@mpd.tandem.com (preferred)
- # GEnie: D.C.Black
- # USnail: 6217 John Chisum Lane, Austin, TX 78749
- #
- ################################################################################
-
- # HISTORY
- #
- # modified who rev reason
- # -------- --- --- ------
- # 01/06/93 DCB 1.0 Original
-
- # DESCRIPTION:
- #
- # listFuncs extracts a list of functions and inserts it
- # (or replaces any current selection) in the current window.
- # The extracted list is left selected. This may then be used
- # for documentation either in the current file or cut/pasted
- # to elsewhere. Also useful in conjunction with the 'canon'
- # procedure.
- #
- # USE:
- #
- # Simple invoke without arguments.
-
- proc listFuncs {} {
- global funcExpr
- global funcPar
- set patt $funcExpr
- set funcExtr "¥¥$funcPar"
- set listFuncs {}
- set done 0
- set pos 0
- set max [maxPos]
- while {!$done} {
- set fp [search -f 1 -r 1 -i 0 -m 0 -n $patt $pos]
- if {[llength $fp] == 2} {
- set s [lindex $fp 0]
- set e [lindex $fp 1]
- set fn [getText $s [expr {$e}]]
- regsub $patt $fn $funcExtr fn
- lappend listFuncs $fn
- set pos [nextLineStart $e]
- } else {
- set done 1
- break
- }
- }
- lappend listFuncs {}
- set text [join $listFuncs "¥r"]
- replaceText [getPos] [selEnd] $text
- goto [expr {[getPos] + [string length $text]}]
- markHilite
- }
- #endproc listFuncs.tcl
-
- ################################################################################
-
-